home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / falcon / programm.ing / nt_dsp1.lzh / NT_DSP1.MSA / FLOAT / FPFLOAT.ASM < prev    next >
Assembly Source File  |  1989-01-24  |  2KB  |  70 lines

  1. ;
  2. ; This program originally available on the Motorola DSP bulletin board.
  3. ; It is provided under a DISCLAIMER OF WARRANTY available from
  4. ; Motorola DSP Operation, 6501 Wm. Cannon Drive W., Austin, Tx., 78735.
  5. ; Last Update 6 Oct 87   Version 2.0
  6. ;
  7. fpfloat ident   2,0
  8. ;
  9. ; MOTOROLA DSP56000/1 FPLIB - VERSION 2
  10. ;
  11. ; FPFLOAT - FIXED POINT TO FLOATING POINT CONVERSION SUBROUTINE
  12. ;
  13. ; Entry points: float_a R = float(A)
  14. ;               float_x R = float(X)
  15. ;
  16. ;       data = 56 bit two's complement fixed point number
  17. ;              consisting of a 48 bit fraction with an 8 bit
  18. ;              integer extension in standard accumulator data
  19. ;              representation.
  20. ;
  21. ;       m = 24 bit mantissa (two's complement, normalized fraction)
  22. ;
  23. ;       e = 14 bit exponent (unsigned integer, biased by +8191)
  24. ;
  25. ; Input variables:
  26. ;
  27. ;   X   x1 = data
  28. ;
  29. ;   A    a = data
  30. ;
  31. ; Output variables:
  32. ;
  33. ;   R   a2 = sign extension of mr
  34. ;       a1 = mr  (normalized)
  35. ;       a0 = zero
  36. ;
  37. ;       b2 = sign extension of er (always zero)
  38. ;       b1 = er
  39. ;       b0 = zero
  40. ;
  41. ; Error conditions:     none
  42. ;
  43. ; Assumes n0, m0, shift constant table and scaling modes
  44. ; initialized by previous call to the subroutine "fpinit".
  45. ;
  46. ; Alters Data ALU Registers
  47. ;       a2      a1      a0      a
  48. ;       b2      b1      b0      b
  49. ;       y1
  50. ;
  51. ; Alters Address Registers
  52. ;       r0
  53. ;
  54. ; Alters Program Control Registers
  55. ;       pc      sr
  56. ;
  57. ; Uses 0 locations on System Stack
  58. ;
  59. ;
  60. float_x tfr     x1,a                    ;get data
  61. float_a tst     a       fp_space:fp_ebias,r0    ;check data, initialize er
  62.         jnr     float1                  ;jump if data normalized
  63. norm8   rep     #8                      ;normalize up to 8 bits left or right
  64.         norm    r0,a                    ;normalize one bit, update er
  65.         jnn     norm8                   ;jump if not normalized
  66. float1  rnd     a                       ;round mr to 24 bits
  67.         norm    r0,a                    ;correct overflow due to rounding
  68.         jmp     check1                  ;go check exponent range
  69.